<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateAppVersionTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        /**
         * CREATE TABLE `t_app_version` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '版本记录ID',
  `platform` tinyint(4) NOT NULL DEFAULT '0' COMMENT '平台;1-IOS,2-Android',
  `old_version` varchar(15) NOT NULL DEFAULT '' COMMENT '待升级版本',
  `new_version` varchar(15) NOT NULL DEFAULT '' COMMENT '新版本',
  `checking_version` varchar(15) NOT NULL DEFAULT '' COMMENT '在审版本',
  `update_link` varchar(300) NOT NULL DEFAULT '' COMMENT '安卓更新地址',
  `update_title` varchar(30) NOT NULL DEFAULT '' COMMENT '升级标题',
  `do_update` tinyint(1) NOT NULL DEFAULT '0',
  `desc` varchar(200) NOT NULL DEFAULT '' COMMENT '升级描述-男版',
  `update_force` tinyint(4) NOT NULL DEFAULT '0' COMMENT '强制更新',
  `valid_at` datetime DEFAULT NULL COMMENT '生效时间',
  `created_at` datetime DEFAULT NULL COMMENT '创建时间',
  `updated_at` datetime DEFAULT NULL COMMENT '更新时间',
  `flag` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态标识位，1有效，0无效',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;


         */
        Schema::create('app_version', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('platform')->default(1)->comment('平台;1-IOS,2-Android');
            $table->string('old_version', 15)->default('')->comment('待升级版本');
            $table->string('new_version', 15)->default('')->comment('新版本');
            $table->string('checking_version', 15)->default('')->comment('在审版本');
            $table->string('update_link', 200)->default('')->comment('安卓更新地址');
            $table->string('update_title', 30)->default('')->comment('升级标题');
            $table->string('desc', 300)->default('')->comment('升级标升级描述题');
            $table->tinyInteger('update_force')->default(0)->comment('是否强制更新');
            $table->timestamp('valid_at')->nullable();
            $table->tinyInteger('flag')->default(1)->comment('1：有效，0：无效');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('app_version');
    }
}
